public class MyQueueUseStackTest {

    public static void main(String[] args) {
        testEmptyQueue();
        testSingleElement();
        testFIFOOrder();
        testMixedOperations();
        testStackTransfer();
        testEdgeCases();
    }

    // 测试空队列
    private static void testEmptyQueue() {
        System.out.println("\n=== 测试空队列 ===");
        MyQueueUseStack q = new MyQueueUseStack();
        System.out.println("空队列empty()预期: true，实际: " + q.empty());
        System.out.println("空队列pop()预期: -1，实际: " + q.pop());
        System.out.println("空队列peek()预期: -1，实际: " + q.peek());
    }

    // 测试单元素操作
    private static void testSingleElement() {
        System.out.println("\n=== 测试单元素 ===");
        MyQueueUseStack q = new MyQueueUseStack();
        q.push(10);
        System.out.println("插入后empty()预期: false，实际: " + q.empty());
        System.out.println("peek()预期: 10，实际: " + q.peek());
        System.out.println("第一次pop()预期: 10，实际: " + q.pop());
        System.out.println("取出后empty()预期: true，实际: " + q.empty());
    }

    // 测试先进先出顺序
    private static void testFIFOOrder() {
        System.out.println("\n=== 测试FIFO顺序 ===");
        MyQueueUseStack q = new MyQueueUseStack();
        q.push(1);
        q.push(2);
        q.push(3);

        System.out.println("第1次pop预期1，实际：" + q.pop());
        System.out.println("第2次pop预期2，实际：" + q.pop());
        System.out.println("第3次pop预期3，实际：" + q.pop());
        System.out.println("全部取出后empty预期true，实际：" + q.empty());
    }

    // 测试混合操作
    private static void testMixedOperations() {
        System.out.println("\n=== 测试混合操作 ===");
        MyQueueUseStack q = new MyQueueUseStack();
        q.push(100);
        q.push(200);
        System.out.println("首次pop预期100，实际：" + q.pop());

        q.push(300);
        System.out.println("第二次pop预期200，实际：" + q.pop());
        System.out.println("第三次peek预期300，实际：" + q.peek());
        System.out.println("第三次pop预期300，实际：" + q.pop());
    }

    // 测试栈间转移
    private static void testStackTransfer() {
        System.out.println("\n=== 测试栈数据转移 ===");
        MyQueueUseStack q = new MyQueueUseStack();
        q.push(5);
        q.push(10);

        System.out.println("首次pop预期5，实际：" + q.pop()); // 触发转移

        q.push(15); // 添加到inputStack
        System.out.println("第二次pop预期10，实际：" + q.pop());
        System.out.println("第三次pop预期15，实际：" + q.pop());
    }

    // 测试边界情况
    private static void testEdgeCases() {
        System.out.println("\n=== 测试边界情况 ===");
        MyQueueUseStack q = new MyQueueUseStack();
        System.out.println("空队列pop预期-1，实际：" + q.pop());

        q.push(9);
        q.pop();
        System.out.println("清空后pop预期-1，实际：" + q.pop());

        q.push(8);
        System.out.println("复用队列pop预期8，实际：" + q.pop());
    }
}